<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>数据库管理</title>
    <link rel="stylesheet" href="__ADMIN__/vendor/layui/css/layui.css">
    <link rel="stylesheet" href="__ADMIN__/custom/css/style.css">
</head>

<body style="padding:10px 10px;">
    <form action="" class="layui-form">
        <button class="layui-btn layui-btn-danger" onclick="backup('{$table}')"><i class="layui-icon"></i>备份</button>
        <table class="layui-table" lay-size="sm">
            <colgroup>
                <col>
                <col >
                <col >
                <col width="50">
                <col width="200">
            </colgroup>
            <thead>
                <tr>
                    <th>{$Think.lang.backuptime}</th>
                    <th>{$Think.lang.backname}</th>
                    <th>{$Think.lang.filesize}</th>
                    <th>{$Think.lang.type}</th>
                    <th>{$Think.lang.caoz}</th>
                </tr>
            </thead>
            <tbody>
                {volist name="list" id="vo"}
                <tr>
                  <td>{$vo.time|date="Y/m/d H:i:s",###}</td>
                  <td>{$vo.filename}</td>
                  <td>{:size_format($vo.size)}</td>
                  <td>{$vo.compress}</td>
                  <td class="td-manage">
                    <a href="{:url('admin/database/download',['name'=>$vo.filename,'time'=>$vo.time])}" class="layui-btn layui-btn-mini">{$Think.lang.down}</a>
                    <a href="javascript:;" onclick="restore('{$table}','{$vo.time}')" class="layui-btn layui-btn-warm layui-btn-mini">{$Think.lang.restore}</a>
                    <a href="javascript:;" onclick="del('{$table}','{$vo.time}')" class="layui-btn  layui-btn-danger layui-btn-mini del">{$Think.lang.del}</a>
                  </td>
                </tr>
              {/volist}
            </tbody>
        </table>
    </form>
    <script src="__ADMIN__/vendor/js/jquery.js"></script>
    <script src="__ADMIN__/vendor/layui/layui.js"></script>
    <script src="__ADMIN__/custom/js/admin.js"></script>
    <script>
        layui.use(['layer', 'form'], function () {
            var layer = layui.layer;
            var form = layui.form;
           
        });
        // 备份
        function backup(tablename){
            $.post("{:url('database/DbBackup')}",{name:tablename},function(res){
                layer.msg(res.msg,{time:1000},function () {
                    location.reload();
                 });
            });
        }
         // 还原
         function restore(tablename,time){
            $.post("{:url('database/restore')}",{name:tablename,time:time},function(res){
                layer.msg(res.msg,{time:1000,icon:1},function () {
                    location.reload();
                 });
            });
        }
         // 删除
         function del(tablename,time){
            $.post("{:url('database/del')}",{name:tablename,time:time},function(res){
                layer.msg(res.msg,{time:1000,icon:1},function () {
                    location.reload();
                 });
            });
        }
        
       
           
           
    </script>
</body>

</html>